//
//  SJHomeTitleButton.swift
//  SJWeiboSwift
//
//  Created by app;e on 15/10/4.
//  Copyright © 2015年 world. All rights reserved.
//   首页顶部的按钮

import UIKit

class SJHomeTitleButton: UIButton {

    
    ///快速创建的类方法
    class func titleButton(title: String)->SJHomeTitleButton {
        let titleButton = SJHomeTitleButton()
        titleButton.setTitle(title+" ", forState: UIControlState.Normal)
        titleButton.setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        titleButton.titleLabel?.font = UIFont.systemFontOfSize(17.0)
        titleButton.setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        return titleButton
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        //swift 2.0 中 可以直接 修改 控件内容的frame
        titleLabel!.frame.origin.x = 0
        imageView!.frame.origin.x = titleLabel!.frame.size.width
    }
    
}
